package be.jaisy.osgi.console.ui.equinox;

import java.util.Hashtable;

import org.eclipse.osgi.framework.console.CommandProvider;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;

import be.jaisy.osgi.AbstractActivator;

public class Activator extends AbstractActivator {
	
	private ServiceRegistration commandProvider;
	
	@Override
	public void start(BundleContext context) throws Exception {		
		super.start(context);	
		commandProvider = context.registerService(CommandProvider.class.getName(), new ProjectCommandProvider(context), new Hashtable<String, String>());
	}

	@Override
	public void stop(BundleContext context) throws Exception {
		if(commandProvider!=null){
			commandProvider.unregister();
			commandProvider = null;
		}		
		super.stop(context);
	}

}
